﻿using IOP.Extension.Cache;
using IOP.Pulsar.Abstractions;
using IOP.Pulsar.MQTT;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace UAVDemo.Server
{
    public class Startup : IStartup
    {

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMQTT().AddRedisCacheService(options =>
            {
                options.ConnectionStrings = new string[] { "127.0.0.1:6379,connectTimeout=1000,connectRetry=1,syncTimeout=10000" };
            });
        }


        public void Configure(IServerBuilder server, IHostEnvironment env)
        {
            server.BuildPipeline<MQTTContext>(builder =>
            {
                builder.UseMQTTControlCenter();
            });
        }
    }
}
